<?php

use yii\helpers\Html;
use common\wosotech\base\GridView;

/* @var $this yii\web\View */
/* @var $searchModel common\models\OptionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '商品规格';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="option-index">

    <?php /* 
    <?= \yii\bootstrap\Nav::widget([
        'options' => [
            'class' => 'nav nav-tabs',
            'style' => 'margin-bottom: 15px'
        ],
        'items' => [
            [
                'label'   => 'Tabs-1',
                'url'     => ['index', 'cat' => 1],
                'active' => Yii::$app->request->get('cat') == 1,
            ],
            [
                'label'   => 'Tabs-2',
                'url'     => ['index', 'cat' => 2],
                'active' => true,
            ],
        ]
    ]) ?>
    */
 ?>
    <h1 style="display:none;"><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?php echo Html::a('创建', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

<!--    --><?php //$form = common\wosotech\base\ActiveForm::begin(['fieldConfig' => [
//        'enableLabel' => false,
//    ]
//    ]); ?>
<!---->
<!--    --><?php //$this->beginBlock('panel'); ?>
<!--    <div class="form-group row">-->
<!--        <div class="col-md-3">-->
<!--            --><?php //echo $form->field($searchModel, 'id')->dropDownList([1 => 'YES', '0' => 'NO']) ?>
<!--        </div>-->
<!--        <div class="col-md-3">-->
<!--            --><?php //echo $form->field($searchModel, 'id')->textInput(['placeholder' => 'ID']) ?>
<!--        </div>-->
<!--        <div class="col-md-3">-->
<!--            --><?php //echo Html::submitInput('Begin', ['name' => 'begin', 'class' => 'btn btn-primary', 'data' => ['confirm' => '确认?']]) ?>
<!--        </div>-->
<!---->
<!--        --><?php //        $js = <<<EOD
//        $(".grid-panel .btn").click(function() {
//            var ids = $('#grid_id').yiiGridView('getSelectedRows');
//            if (ids.length == 0) {
//                alert("请至少勾选一条记录!");
//                return false;
//            }
//            return true;
//        });
//EOD;
//        $this->registerJs($js, yii\web\View::POS_READY);
//        ?>
<!--    </div>-->
<!--    --><?php //$this->endBlock(); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'options' => ['id' => 'grid_id', 'class' => 'table-responsive'],
        //'layout' => "{summary}\n{items}\n<div class='grid-panel hide'>{$this->blocks['panel']}</div>\n{pager}",
        'filterModel' => $searchModel,
        'columns' => [
            //['class' => 'yii\grid\SerialColumn'], 
            //['class' => 'yii\grid\CheckboxColumn'],
                        //'id',
            [
                'attribute' => 'id',
                'headerOptions' => array('style' => 'width:60px;'),
                'filter' => false,
                //'visible' => false,
            ],
            [
                'attribute' => 'type',
                'filter' => false,
                'visible' => false,
            ],
            [
                'attribute' => 'name',
                'headerOptions' => array('style' => 'width:150px;'),
            ],
            [
                'attribute' => 'alias',
                'headerOptions' => array('style' => 'width:250px;'),
                'visible' => false,
            ],
            //'name',
            //'sort_order',
            //'created_at',
            // 'updated_at',
            [
                'attribute' => 'valuesString',
                'format' => 'raw',
//                'value' => function ($model, $key, $index, $column) {
//                    return Html::a('编辑', ['/option-value/index', 'option_id' => $model->id]) . ' ' . $model->valuesString;
//                },
                'headerOptions' => array('style' => 'width:500px;'),
            ],

            [
                'attribute' => 'sort_order',
                'filter' => false,
                'visible' => false,
            ],

            [
                'class' => 'yii\grid\ActionColumn',
                //'template' => '{update} {view} {delete}',
                //'template' => '{update} {delete}',
                'template' => YII_ENV_DEV ? '{update} {view} {delete}' : '{update} {view}',

            ]
        ],
    ]); ?>

<!--    --><?php //common\wosotech\base\ActiveForm::end(); ?>


</div>

<?//= $this->render('_form_inline', [
//    'model' => $model,
//]) ?>

